<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/kernel/qmime_win.cpp -->
<head>
  <title>Qt 4.3: QWindowsMime Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QWindowsMime Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QWindowsMime class maps open-standard MIME to Window Clipboard formats. <a href="#details">More...</a></p>
<pre> #include &lt;QWindowsMime&gt;</pre><ul>
<li><a href="qwindowsmime-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qwindowsmime.html#QWindowsMime">QWindowsMime</a></b> ()</li>
<li><div class="fn"/>virtual <b><a href="qwindowsmime.html#dtor.QWindowsMime">~QWindowsMime</a></b> ()</li>
<li><div class="fn"/>virtual bool <b><a href="qwindowsmime.html#canConvertFromMime">canConvertFromMime</a></b> ( const FORMATETC &amp; <i>formatetc</i>, const QMimeData * <i>mimeData</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qwindowsmime.html#canConvertToMime">canConvertToMime</a></b> ( const QString &amp; <i>mimeType</i>, IDataObject * <i>pDataObj</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qwindowsmime.html#convertFromMime">convertFromMime</a></b> ( const FORMATETC &amp; <i>formatetc</i>, const QMimeData * <i>mimeData</i>, STGMEDIUM * <i>pmedium</i> ) const = 0</li>
<li><div class="fn"/>virtual QVariant <b><a href="qwindowsmime.html#convertToMime">convertToMime</a></b> ( const QString &amp; <i>mimeType</i>, IDataObject * <i>pDataObj</i>, QVariant::Type <i>preferredType</i> ) const = 0</li>
<li><div class="fn"/>virtual QVector&lt;FORMATETC&gt; <b><a href="qwindowsmime.html#formatsForMime">formatsForMime</a></b> ( const QString &amp; <i>mimeType</i>, const QMimeData * <i>mimeData</i> ) const = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qwindowsmime.html#mimeForFormat">mimeForFormat</a></b> ( const FORMATETC &amp; <i>formatetc</i> ) const = 0</li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</h3>
<ul>
<li><div class="fn"/>int <b><a href="qwindowsmime.html#registerMimeType">registerMimeType</a></b> ( const QString &amp; <i>mime</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QWindowsMime class maps open-standard MIME to Window Clipboard formats.</p>
<p>Qt's drag-and-drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol, but on Windows although some applications use MIME types to describe clipboard formats, others use arbitrary non-standardized naming conventions, or unnamed built-in formats of Windows.</p>
<p>By instantiating subclasses of QWindowsMime that provide conversions between Windows Clipboard and MIME formats, you can convert proprietary clipboard formats to MIME formats.</p>
<p>Qt has predefined support for the following Windows Clipboard formats:</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Windows Format</th><th>Equivalent MIME type</th></tr></thead>
<tr valign="top" class="odd"><td><tt>CF_UNICODETEXT</tt></td><td><tt>text/plain</tt></td></tr>
<tr valign="top" class="even"><td><tt>CF_TEXT</tt></td><td><tt>text/plain</tt></td></tr>
<tr valign="top" class="odd"><td><tt>CF_DIB</tt></td><td><tt>image/xyz</tt>, where <tt>xyz</tt> is a <a href="qimagewriter.html#supportedImageFormats">Qt image format</a></td></tr>
<tr valign="top" class="even"><td><tt>CF_HDROP</tt></td><td><tt>text/uri-list</tt></td></tr>
<tr valign="top" class="odd"><td><tt>CF_INETURL</tt></td><td><tt>text/uri-list</tt></td></tr>
<tr valign="top" class="even"><td><tt>CF_HTML</tt></td><td><tt>text/html</tt></td></tr>
</table></p>
<p>An example use of this class would be to map the Windows Metafile clipboard format (<tt>CF_METAFILEPICT</tt>) to and from the MIME type <tt>image/x-wmf</tt>. This conversion might simply be adding or removing a header, or even just passing on the data. See <a href="dnd.html">Drag and Drop</a> for more information on choosing and definition MIME types.</p>
<p>You can check if a MIME type is convertible using <a href="qwindowsmime.html#canConvertFromMime">canConvertFromMime</a>() and can perform conversions with <a href="qwindowsmime.html#convertToMime">convertToMime</a>() and <a href="qwindowsmime.html#convertFromMime">convertFromMime</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QWindowsMime"></a>QWindowsMime::QWindowsMime ()</h3>
<p>Constructs a new conversion object, adding it to the globally accessed list of available converters.</p>
<h3 class="fn"><a name="dtor.QWindowsMime"></a>QWindowsMime::~QWindowsMime ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys a conversion object, removing it from the global list of available converters.</p>
<h3 class="fn"><a name="canConvertFromMime"></a>bool QWindowsMime::canConvertFromMime ( const FORMATETC &amp; <i>formatetc</i>, const <a href="qmimedata.html">QMimeData</a> * <i>mimeData</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the converter can convert from the <i>mimeData</i> to the format specified in <i>formatetc</i>.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="canConvertToMime"></a>bool QWindowsMime::canConvertToMime ( const <a href="qstring.html">QString</a> &amp; <i>mimeType</i>, IDataObject * <i>pDataObj</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the converter can convert to the <i>mimeType</i> from the available formats in <i>pDataObj</i>.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="convertFromMime"></a>bool QWindowsMime::convertFromMime ( const FORMATETC &amp; <i>formatetc</i>, const <a href="qmimedata.html">QMimeData</a> * <i>mimeData</i>, STGMEDIUM * <i>pmedium</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Convert the <i>mimeData</i> to the format specified in <i>formatetc</i>. The converted data should then be placed in <i>pmedium</i> structure.</p>
<p>Return true if the conversion was successful.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="convertToMime"></a><a href="qvariant.html">QVariant</a> QWindowsMime::convertToMime ( const <a href="qstring.html">QString</a> &amp; <i>mimeType</i>, IDataObject * <i>pDataObj</i>, <a href="qvariant.html#Type-enum">QVariant::Type</a> <i>preferredType</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns a <a href="qvariant.html">QVariant</a> containing the converted data for <i>mimeType</i> from <i>pDataObj</i>. If possible the <a href="qvariant.html">QVariant</a> should be of the <i>preferredType</i> to avoid needless conversions.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="formatsForMime"></a><a href="qvector.html">QVector</a>&lt;FORMATETC&gt; QWindowsMime::formatsForMime ( const <a href="qstring.html">QString</a> &amp; <i>mimeType</i>, const <a href="qmimedata.html">QMimeData</a> * <i>mimeData</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns a <a href="qvector.html">QVector</a> of FORMATETC structures representing the different windows clipboard formats that can be provided for the <i>mimeType</i> from the <i>mimeData</i>.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="mimeForFormat"></a><a href="qstring.html">QString</a> QWindowsMime::mimeForFormat ( const FORMATETC &amp; <i>formatetc</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the mime type that will be created form the format specified in <i>formatetc</i>, or an empty string if this converter does not support <i>formatetc</i>.</p>
<p>All subclasses must reimplement this pure virtual function.</p>
<h3 class="fn"><a name="registerMimeType"></a>int QWindowsMime::registerMimeType ( const <a href="qstring.html">QString</a> &amp; <i>mime</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Registers the MIME type <i>mime</i>, and returns an ID number identifying the format on Windows.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
